package com.zjsm.system;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

import com.zjsm.component.CircleButton;
import com.zjsm.music.Mention;

public class Intro extends JFrame {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JLabel lable;
	private CircleButton back;

	public Intro() {
		this.setTitle("这就是命五子棋——关于游戏");
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(3);
		this.setSize(370, 243);
		this.setLayout(null);
		this.setResizable(false);
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
		this.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){
				//提示音效
				try {
					new Mention().play();
				} catch (IOException ex) {
					// TODO 自动生成的 catch 块
					ex.printStackTrace();
				}
				
//				int option = JOptionPane.showConfirmDialog(
//						Intro.this, "是否退出游戏？", "退出提示", JOptionPane.YES_NO_OPTION);
//				if(option == JOptionPane.YES_OPTION) {
//					System.exit(0);
//				} else {
//					return;
//				}
			}
		});	
		
		init();
		
	}
	
	private void init() {
		lable = new JLabel("这就是命五子棋由西邮软件1501，602小组开发");
		lable.setFont(new Font("华文行楷", 0, 17));
		lable.setForeground(Color.BLACK);
		lable.setBounds(10, 10, 350, 50);
		this.add(lable);
		
		lable = new JLabel("组长：姜文昊");
		lable.setFont(new Font("华文行楷", 0, 17));
		lable.setForeground(Color.BLACK);
		lable.setBounds(10, 40, 400, 50);
		this.add(lable);
		
		lable = new JLabel("组员：程龙、刘益豪、梁嘉龙、杨迪、徐康");
		lable.setFont(new Font("华文行楷", 0, 17));
		lable.setForeground(Color.BLACK);
		lable.setBounds(10, 70, 400, 50);
		this.add(lable);
		
		back = new CircleButton("确定");
		back.setFont(new Font("华文行楷", 0, 20));
		back.setForeground(Color.YELLOW);
		back.setBounds(115, 135, 120, 30);
		back.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Intro.this.dispose();
			}
		});
		this.add(back);
		
		this.setVisible(true);
	}
	
}
